package net.caixiaomi.info.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;

import net.caixiaomi.info.R;
import net.caixiaomi.info.base.quickadapter.BaseQuickAdapter;
import net.caixiaomi.info.base.quickadapter.BaseViewHolder;
import net.caixiaomi.info.base.quickadapter.entity.MultiItemEntity;
import net.caixiaomi.info.model.DividerEntity;
import net.caixiaomi.info.model.LeagueCountryEntity;
import net.caixiaomi.info.ui.view.DividerView;

/**
 * Created by mac on 2018/9/8.
 */

public class LeagueCountryAdapter extends BaseQuickAdapter<MultiItemEntity, BaseViewHolder> {
    public LeagueCountryAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, MultiItemEntity item) {
        try {
            DividerView dividerView=helper.getView(R.id.divider_view);
            dividerView.clearDivider();
            DividerEntity divider= (DividerEntity) item;
            for(int i=0;i<divider.dividerType.size();i++){
                dividerView.setStyle(divider.dividerType.get(i));
            }
            if(divider.empty){
                dividerView.setChildViewGone();
                if(divider.emptyAll) {
                    dividerView.setChildViewGoneT();
                }
                return;
            }

            LeagueCountryEntity hall = (LeagueCountryEntity) item;
            String name = hall.getContryName();
            String Imgurl = hall.getContryPic();
            helper.setText(R.id.title, name);
            ImageView imageView = helper.getView(R.id.image);
            Glide.with(imageView.getContext()).load(Imgurl).into(imageView);
        }catch (Exception e){

        }
    }
}
